This part studies the relationship between different beats/district. Most of the analyses are in reference with spatial economics which extends the use of 1D statistical tools and some statistics to spatial studies.

The areal analysis begins with creating the block-wise connectivity matrices. Note the key difference with the later Kriging study is that the elements of connectivity matrices are simply 1 or 0, that is two areas are connected or not, while in Kriging, the covariance matrices are dependent of the distances between two locations.

## OGR data source with driver: ESRI Shapefile 
## Source: "/Users/xiaomuliu/CrimeProject/SpatioTemporalModeling/CPDShapeFiles/", layer: "district_bndy"
## with 28 features and 3 fields
## Feature type: wkbPolygon with 2 dimensions
## OGR data source with driver: ESRI Shapefile 
## Source: "/Users/xiaomuliu/CrimeProject/SpatioTemporalModeling/CPDShapeFiles/", layer: "beat_bndy"
## with 288 features and 3 fields
## Feature type: wkbPolygon with 2 dimensions

Regional total amount of violent crimes (2008-2014)

Note: the district shape file has 28 district polygons and 26 distinct district numbers, while the data has 26 unique district numbers. Because the side effect of plotting polygons creates two “byproduct” districts. The district numbers in these two files match though. However, the beat shape file has 288 polygons and 286 unique beat numbers, while the dataset has 305 unique beat numbers. Mismatching beats (the ones are not shown in the shape file but exist in the crime data):

##  [1]  114  121  215  225  235  310  430 1214 1215 1221 1225 1234 1235 1914
## [15] 1915 1921 1925 1934 1935

Pooled spatial autocorrelation: Moran’s I test.

The Moran’s I coeffcient calculates the ratio between the product of the variable of interest and its spatial lag, with the product of the variable of interest, adjusted for the spatial weights used. \[ I_i = \frac{n}{\sum_{i=1}^{n}\sum_{j=1}^{n}W_{ij}}\frac{\sum_{i=1}^{n}\sum_{j=1}^{n}W_{ij}(y_i-\bar{y})(y_j-\bar{y})}{\sum_{i}^{n}(y_i-\bar{y})} \] This statistic ranges from -1 to +1. A zero value indicates a random spatial pattern. Under the null hypothesis of no autocorrelation, \[E[I]=-\frac{1}{n-1}\]

Not surprisingly, the city-wide spatial correlation is strong.

## 
##  Moran's I test under randomisation
## 
## data:  district.spdf$INC_CNT  
## weights: W_conn_mat.district  
## 
## Moran I statistic standard deviate = 3.8547, p-value = 5.793e-05
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##        0.48196021       -0.03703704        0.01812780
## 
##  Moran's I test under randomisation
## 
## data:  beat.spdf$INC_CNT  
## weights: W_conn_mat.beat  
## 
## Moran I statistic standard deviate = 18.2089, p-value < 2.2e-16
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       0.647058024      -0.003484321       0.001276394

Moran scatterplot: a plot of spatial data against its spatially lagged values. Marked points (with the district/beat numbsers) are the ones with high influence measures for the linear relationship.

Global tests for spatial autocorrelation are calculated from local relationships between observed values at spatial units and their neighbors. It is possible to break these measures down into their components. A local Moran’s I coeffcient for unit i can be constructed as one of the n components which comprise the global test: \[ I_i= \frac{n(y_i-\bar{y})\sum_{j=1}^{n}W_{ij}(y_j-\bar{y})}{\sum_{i}^{n}(y_i-\bar{y})} \]

The map below displays each region’s contribution to the global Moran’s I.

The district-level aggregation seems to be too coarse. The following analysis will be focused on the beat only.

Now let’s see if (global) Moran’s I statistics have any temporal patterns. The plot below shows that hot months have a little stronger spatial autocorrelation that cold months. Also there is no obvious climbing-up or climbing-down long-term trend.

The daily (global) Moran’s I statistics time series plot unveils this pattern more clearly.

The following animation is aimed to explore if there exists migration regarding the each beat’s local Moran’s I. (It’d be less confusing if we were able to the same color scale for each frame. But we have not found a way to do that.)

LocalMoran animation